home *** CD-ROM | disk | FTP | other *** search
- On 07-Oct-97, MtL ManUtd wrote:
- >can anybody show me a little example on how the hunt command works?
-
- I've been a bit distracted lately, but I found a short example
- that might be useful as an example. I have not seen any other
- responses, but if you already have the hang of HUNTing, just
- smack the old delete button.
-
- The following code strips out the less than usefull elements
- of an 8SVX file, correcting several common problems in the
- process, and rewrites it. The PSVX routine uses HUNT to locate
- the header and body chunks of the just processed file to play
- it. Note that the PSVX routine knows it has been passed a
- bank with a good iff 8svx form, so it doesn't error check.
-
- Hope this helps, (or at least doesnt get in your way)
- -Richard
-
- ' signatures for sample files
- Global SIGFORM,SIG8SVX,SIGVHDR,SIGBODY
- LCONST["FORM"] : SIGFORM=Param
- LCONST["8SVX"] : SIG8SVX=Param
- LCONST["VHDR"] : SIGVHDR=Param
- LCONST["BODY"] : SIGBODY=Param
- ' audio fade variables
- B$=Fsel$("**")
- If B$="" Then Stop
- Open In 1,B$
- X=Lof(1)+42
- Close 1
- Reserve As Work 10,X
- Reserve As Work 11,X
- '
- STRIPSVX[B$]
- '
- Procedure STRIPSVX[N$]
- 'Follow I,L,J,K
- A$=" " : A$=A$+A$+A$+A$
- I=Start(10)
- NI=Start(11)
- Bload N$,Start(10)
- If Leek(I)=SIGFORM and Leek(I+8)=SIG8SVX
- Print "FORM ";
- Add I,4
- L=Leek(I)
- Print " Len ";L;" ";
- Add I,4
- Copy Start(10),Start(10)+12 To NI : Add NI,12
- For J=1 To 4 : Print Chr$(Peek(I)); : Add I,1 : Next J : Print
- T=Start(10)+L
- While I<T
- If Leek(I)=SIGVHDR or Leek(I)=SIGBODY
- Print "rewriting . . . ";
- CL=Leek(I+4)+8
- Copy I,I+CL To NI
- If(CL mod 2)=1 : Inc CL : End If
- NI=NI+CL
- Else
- Print "skipping . . . ";
- End If
- Print "Chunk ";
- For J=1 To 4 : Print Chr$(Peek(I)); : Add I,1 : Next J
- K=Leek(I)
- Print " Len ";K
- Add K,4
- If(K mod 2)=1 : Inc K : End If
- Add I,K
- Wend
- Loke Start(11)+4,NI-Start(11)-8
- PSVX
- Bsave N$,Start(11) To NI
- Else
- Print "Not an IFF FORM"
- End If
- End Proc
- '
- Procedure LCONST[A$]
- A=Leek(Varptr(A$))
- End Proc[A]
- '
- Procedure PSVX
- Voice %111
- Volume %1000,63
- If Leek(Start(11))=SIGFORM and Leek(Start(11)+8)=SIG8SVX
- SBEG=Hunt(Start(11) To Start(11)+64,"VHDR")
- SLEN=Leek(SBEG+8)+Leek(SBEG+12)
- SRATE=Deek(SBEG+20)
- SBEG=Hunt(SBEG To SBEG+512,"BODY")
- SBEG=SBEG+8
- Sam Raw %1000,SBEG,SLEN,SRATE
- End If
- End Proc
- '
-
-
-
-